package com.rsk.dao.curriculum;


import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.rsk.entity.curriculum.RskCourseCategory;



@Repository
public interface RskCourseCategoryRepository extends JpaRepository<RskCourseCategory, Long>,JpaSpecificationExecutor<RskCourseCategory>,Serializable {
	
	@SuppressWarnings("rawtypes")
	@Query(value = "select id, financial_type, financial_proportion, making_company_id from rsk_task_financials where is_del = 0", nativeQuery = true)
	public List<Map> selectAllData();
	
	@Modifying
	@Query(value = "update rsk_course_category set is_del = 1, operator_user =?2, operator_time = NOW() where id =?1", nativeQuery = true)
	public int delRskCourseCategory(Long id, Long operatorUser);
	
	
	@Modifying
	@Query(value = "update rsk_course_category set is_see = ?2, operator_user =?3, operator_time = NOW() where id =?1", nativeQuery = true)
	public int updateCourseCategorySee(Long id, Integer isSee, Long operatorUser);
	
	@Modifying
	@Query(value = "update rsk_course_category set category_name = ?2, sort= ?3, operator_user =?4, operator_time = NOW() where id =?1", nativeQuery = true)
	public int updateCourseCategory(Long id, String categoryName, Integer sort, Long operatorUser);
	
}
 